# -*- coding: utf-8 -*-
# @Time : 2021/2/3 上午 9:50
# @Author : lijunlong
# @Email : 729619494@qq.com
# @File : ljl_test.py
# @Project : test0
from selenium import webdriver
from pages.addclient_page import AddClientPage
from time import sleep
import os

driver = webdriver.Chrome()
herefile_path = os.path.dirname(os.path.abspath(__file__))
# 这里是获得这个文件所在的文件夹绝对路径，就算换了电脑也是那台电脑的绝对路径
datas_path = os.path.join(herefile_path, "datas")
path2 = os.path.dirname(os.path.dirname(__file__))

try:
    print(herefile_path,datas_path,path2)
    ad = AddClientPage(driver)
    ad.use_cookies(AddClientPage)
    ad.creat_client(clientname="海123")
    sleep(4)
except Exception:
    raise
finally:
    sleep(1)
    driver.quit()


# cookies = driver.get_cookies()
# gl._init(cookies)
# driver.get("http://192.168.1.48/")
# driver.add_cookie(gl.get_global())
# driver.get("http://192.168.1.48/crm4/v0.5.5/index.php?m=customer&a=add")
